The MyGeotab SDK is a powerful tool which allows anyone to access their own data. Geotab provides libraries in C# and JavaScript to access the data, but the API is language agnostic and there are several other contributed "wrappers" written in several other languages. One of these wrappers is for use in Python.
In recent years, Python has become more and more prevalent for use in data analysis, and tools like Jupyter notebooks have made it easier and easier to work with and explore data.
In [ ]:
%%capture
!pip install mygeotab
!pip install pandas
In [ ]:
import mygeotab
import pandas as pd
import getpass
In [ ]:
username = input('Username: ')
database = input('Database: ')
client = mygeotab.API(username=username, password=getpass.getpass('Password: '), database=database)
In [ ]:
client.authenticate()
In [ ]:
device_statuses = client.get('DeviceStatusInfo')
In [ ]:
%%capture
!pip install folium
In [ ]:
import folium
In [ ]:
m = folium.Map(location=[44, -73], zoom_start=5)
marker_cluster = folium.MarkerCluster().add_to(m)
In [ ]:
for status in device_statuses:
if status.get('latitude'):
device = status['device']
folium.Marker(
location=[status.get('latitude'), status.get('longitude')],
popup=device['id']
).add_to(marker_cluster)
In [ ]:
m
In [ ]: